using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

[Serializable]
public class MaterialFloatAnim : EasyAnimBase
{
    public string materialProperty;
    public AnimationCurve curve;
    [HideInInspector]
    public Renderer renderer;
}

public class MaterialFloatAnimation : EasyAnimation<MaterialFloatAnim>
{
    protected override void Awake()
    {
        base.Awake();
        for (int i = 0; i < anims.Length; i++)
        {
            anims[i].renderer = anims[i].targetObject.GetComponent<Renderer>();
        }
    }

    protected override void ApplyAnim(MaterialFloatAnim anim, float process)
    {
        float val = anim.curve.Evaluate(process) * anim.multiply;
        anim.renderer.material.SetFloat(anim.materialProperty, val);
    }
}
